home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / hostfix.zip / FIXHOST.ASM < prev    next >
Assembly Source File  |  1987-01-08  |  2KB  |  76 lines

  1.  
  2. code    segment
  3.  
  4.         assume cs:code;ds:code
  5.         org     100h
  6.  
  7. begin:  jmp     start
  8.  
  9. comx    equ     03f9h                   ;IER register for COM1:
  10.                                         ;   Use 02f9h for COM2:
  11.  
  12. file    db      'C:\COMMAND.COM',0      ;Drive & path to COMMAND.COM
  13.  
  14. env_str dw      ?
  15.         dw      80h                     ;PSP parameters
  16. pt1     dw      ?
  17.         dw      5ch
  18. pt2     dw      ?
  19.         dw      6ch
  20. pt3     dw      ?
  21.  
  22. start:
  23.  
  24.         mov al,00h                      ; Zap modem IER register with 00h
  25.         mov dx,comx                     ; to disable UART interrupts
  26.         out dx,al                       ; before calling COMMAND.COM
  27.  
  28.         push    cs
  29.         pop     es
  30.         call    find_endfile            ; Find end of code
  31.         mov     cl,4
  32.         sar     bx,cl
  33.         inc     bx
  34.         mov     ah,4ah                  ; Shrink memory to minimum needed
  35.         int     21h
  36.         jc      error
  37.  
  38. ;------build param block the way DOS EXEC (4Bh) call wants it
  39.  
  40.         mov     si,2ch
  41.         mov     ax,word ptr ╒siσ
  42.         mov     env_str,ax
  43.         push    cs
  44.         pop     ax
  45.         mov     pt1,ax                  ; Pass parameters, if any
  46.         mov     pt2,ax
  47.         mov     pt3,ax
  48.         mov     bx,offset env_str
  49.         mov     dx,offset file
  50.  
  51.         mov     ax,4b00h                ; Call COMMAND.COM
  52.         int     21h
  53.         pushf
  54.  
  55.         mov al,01h                      ; Zap modem IER register with 01h
  56.         mov dx,comx                     ; to enable UART interrupts
  57.         out dx,al                       ; before returnning to PROCOMM
  58.  
  59.         popf
  60.         jc      error                   ;In case something goes wrong
  61.         mov     ax,4c00h                ;No problem, reset carry & return
  62.         int     21h
  63.  
  64. error:
  65.         mov     ax,4cffh                ;Return with carry set
  66.         int     21h
  67.  
  68. FIND_ENDFILE:
  69.         CALL    HERE
  70. HERE:   POP     BX
  71.         ADD     BX,6
  72.         RET
  73.  
  74. code    ends
  75.         end     begin
  76.